<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id')->comment('主键');
            $table->integer('company_id')->default(0)->comment('上次登录公司ID');
            $table->string('name',255)->comment('用户姓名');
            $table->string('mobile',64)->comment('手机号码')->unique();
            $table->string('salt',255)->comment('加密因子');
            $table->string('password',255)->comment('密码');
            $table->string('image',255)->nullable()->comment('头像');
            $table->string('pc_token',255)->comment('PCtoken');
            $table->string('mobile_token',255)->comment('手机token');
            $table->string('accid',255)->nullable()->comment('云信账户');
            $table->string('acc_token',255)->nullable()->comment('云信token');
            $table->tinyInteger('status')->default('0')->comment('0正常，1删除');
            $table->integer('created_at')->comment('创建时间');
            $table->integer('updated_at')->comment('最后更新时间');
//            $table->timestamps();
        });
        DB::statement("ALTER TABLE `users` comment '用户表'");
    }
    
    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
